class Counter < Pan::Component

  def initialize bg_color
    @bg_color = bg_color
    @count = 0 
  end 

  def value
    @count
  end
  
  def render_on(html) 
    html.tag("div", {"style"=>{
                 "padding"=>"4px",
                 "margin"=>"8px",
                 "border"=>"solid 1px",
                 "background-color"=>"#{@bg_color.to_s}",
                 "float"=>"left;width: 200px"}}) do
      html.heading("Hello World: #{@count}",2) 
      html.tag("p"){html.text("this is fun!!!")}
      html.link("--"){@count -= 1; @bg_color.dec} 
      html.space 
      html.link("++"){@count += 1; @bg_color.inc} 
    end
  end 
end
